home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Programmation / jedit / jedit5.1.0install.exe / {app} / macros / Clipboard / Paste_Indent.bsh < prev   
Text File  |  2013-07-28  |  1KB  |  35 lines

  1. /*
  2.  * Paste_Indent.bsh - a BeanShell macro script for the
  3.  * jEdit text editor - Paste the content of the clipboard and indent it.
  4.  * Copyright (C) 2007 Matthieu Casanova
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU General Public License
  8.  * as published by the Free Software Foundation; either version 2
  9.  * of the License, or any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with the jEdit program; if not, write to the Free Software
  18.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  *
  20.  * $Id$
  21.  */
  22.  
  23. BufferListener bufferListener = new BufferAdapter()
  24. {
  25.     public void contentInserted(JEditBuffer buffer, int startLine, int offset,
  26.         int numLines, int length)
  27.     {
  28.         buffer.removeBufferListener(this);
  29.         buffer.indentLines(startLine,startLine + numLines);
  30.     }
  31. };
  32. buffer.addBufferListener(bufferListener);
  33.  
  34. Registers.paste(textArea, '$');
  35.